<%@ Page Language="C#" Title="View All Job Applications" MasterPageFile="~/App_Master/MasterPage.master"
    AutoEventWireup="true" CodeFile="ViewJobApplications.aspx.cs" Inherits="ViewJobApplications"
    Theme="Web20CSS" %>

<%@ OutputCache Duration="300" VaryByParam="*" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Navigation" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div>
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
            <telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
                AllowAutomaticUpdates="True" AllowSorting="True" AutoGenerateColumns="False"
                DataSourceID="LinqDataSource1" GridLines="None" ShowGroupPanel="True" Skin="Web20"
                AllowPaging="True" AllowFilteringByColumn="True" AutoGenerateDeleteColumn="True"
                AutoGenerateEditColumn="True">
                <GroupPanel ID="GroupPanel" Style="width: 100%;" Visible="True">
                </GroupPanel>
                <ExportSettings>
                    <Pdf AllowCopy="True" AllowModify="True" Author="Anonymous" Keywords="None" PageBottomMargin="1in"
                        PageLeftMargin="1in" PageRightMargin="1in" PageTopMargin="1in" PageTitle="RadGrid export document"
                        Subject="RadGrid Export" Title="RadGrid export" PaperSize="Letter" FontType="Subset" />
                    <Excel Format="Html" />
                </ExportSettings>
                <PagerStyle Mode="NextPrevAndNumeric" />
                <ClientSettings AllowDragToGroup="True">
                    <Selecting AllowRowSelect="False" />
                </ClientSettings>
                <MasterTableView CommandItemDisplay="None" CurrentResetPageIndexAction="SetPageIndexToFirst"
                    DataKeyNames="ApplicationID" DataSourceID="LinqDataSource1" Dir="LTR" Frame="Border"
                    TableLayout="Auto" PageSize="5">
                    <EditFormSettings>
                        <EditColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType">
                        </EditColumn>
                    </EditFormSettings>
                    <Columns>
                        <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="ApplicationID"
                            DataType="System.Int32" FilterListOptions="VaryByDataType" ForceExtractValue="None"
                            HeaderText="ApplicationID" ReadOnly="True" SortExpression="ApplicationID" UniqueName="ApplicationID"
                            Visible="False">
                        </telerik:GridBoundColumn>
                        <telerik:GridDateTimeColumn CurrentFilterFunction="NoFilter" DataField="Date" DataFormatString="{0:d}"
                            DataType="System.DateTime" FilterListOptions="VaryByDataType" ForceExtractValue="None"
                            HeaderText="Date" SortExpression="Date" UniqueName="Date">
                        </telerik:GridDateTimeColumn>
                        <telerik:GridTemplateColumn HeaderText="Position Name" UniqueName="Position Name">
                            <EditItemTemplate>
                                <telerik:RadTextBox ID="PositionNameTextBox" runat="server" Skin="Web20" Width="200px"
                                    Text='<% #Eval("PositionName") %>'>
                                </telerik:RadTextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="PositionNameLabel" runat="server" Text='<% #Eval("PositionName") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridDropDownColumn DataField="SourceID" DataSourceID="LinqDataSource2" HeaderText="Source"
                            ListTextField="Source" ListValueField="SourceID" UniqueName="SourceDropDownColumn"
                            CurrentFilterFunction="NoFilter" AllowFiltering="false" AllowSorting="false"
                            DropDownControlType="DropDownList" ForceExtractValue="None">
                        </telerik:GridDropDownColumn>
                        <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="CompanyName"
                            FilterListOptions="VaryByDataType" ForceExtractValue="None" HeaderText="CompanyName"
                            SortExpression="CompanyName" UniqueName="CompanyName">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="CompanyEMail"
                            FilterListOptions="VaryByDataType" ForceExtractValue="None" HeaderText="CompanyEMail"
                            SortExpression="CompanyEMail" UniqueName="CompanyEMail">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="City" FilterListOptions="VaryByDataType"
                            ForceExtractValue="None" HeaderText="City" SortExpression="City" UniqueName="City">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="FilePath" FilterListOptions="VaryByDataType"
                            ForceExtractValue="None" HeaderText="FilePath" SortExpression="FilePath" UniqueName="FilePath"
                            Visible="False">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="AdPath" FilterListOptions="VaryByDataType"
                            ForceExtractValue="None" HeaderText="AdPath" SortExpression="AdPath" UniqueName="AdPath"
                            Visible="False">
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn UniqueName="notesColumn" HeaderText="Notes">
                            <ItemTemplate>
                                <asp:Label ID="lblNotes" runat="server" Text='<%# Eval("Notes") %>'>'></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="tbNotes" Height="200px" Width="200px" runat="server" TextMode="MultiLine"
                                    Text='<%# Bind("Notes") %>'></asp:TextBox>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn HeaderText="Cover Letter" AllowFiltering="false" ReadOnly="true">
                            <ItemTemplate>
                                <asp:HyperLink ID="FilePathHyperLink" runat="server" Text="Cover Letter" NavigateUrl='<%#Request.ApplicationPath + "/Applications/" + Eval("CompanyName") +"/" + Eval("FilePath") %>'>
                                </asp:HyperLink>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn HeaderText="Job Ad" AllowFiltering="false" ReadOnly="true">
                            <ItemTemplate>
                                <asp:HyperLink ID="JobAdHyperLink" runat="server" Text="Job Ad" Visible='<%# Eval("AdPath") != null %>'
                                    NavigateUrl='<%#Request.ApplicationPath + "/Applications/" + Eval("CompanyName") + "/" + Eval("AdPath") %>'>
                                </asp:HyperLink>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                    </Columns>
                    <ExpandCollapseColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"
                        Resizable="False" Visible="False">
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>
                    <RowIndicatorColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"
                        Visible="False">
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                    <PagerStyle Mode="NextPrevAndNumeric" />
                </MasterTableView>
                <FilterMenu Skin="Web20" EnableTheming="True">
                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                </FilterMenu>
            </telerik:RadGrid>
        </telerik:RadAjaxPanel>
        <br />
        <div>
            <asp:CheckBox ID="CheckBox1" Text="Export only data" runat="server"></asp:CheckBox>
            <br />
            <asp:CheckBox ID="CheckBox2" Text="Ignore paging (exports all pages)" runat="server">
            </asp:CheckBox>
            <br />
            <asp:CheckBox ID="CheckBox3" Text="Open exported data in new browser window" runat="server">
            </asp:CheckBox>
            <br />
            <br />
            <asp:Button ID="Button1" Visible="false" Width="150px" Text="Export to Excel" OnClick="Button1_Click"
                runat="server"></asp:Button>
            <asp:Button ID="Button2" Width="150px" Text="Export to Word" OnClick="Button2_Click"
                runat="server"></asp:Button>
            <asp:Button ID="Button3" Width="150px" Text="Export to Excel" OnClick="Button3_Click"
                runat="server"></asp:Button>
        </div>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Skin="Web20" runat="server"
            Height="75px" Width="75px">
        </telerik:RadAjaxLoadingPanel>
        <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="CareerPathDataContext"
            EnableDelete="True" EnableInsert="True" EnableUpdate="True" TableName="cp_Applications"
            OrderBy="Date" OnSelected="LinqDataSource1_Selected">
        </asp:LinqDataSource>
        <asp:LinqDataSource ID="LinqDataSource2" runat="server" ContextTypeName="CareerPathDataContext"
            EnableDelete="True" EnableInsert="True" EnableUpdate="True" TableName="cp_SourceTables">
        </asp:LinqDataSource>
    </div>
</asp:Content>
